//
//  CXRecommendHotCollectionViewCell.m
//  Delicious
//
//  Created by dllo on 15/11/27.
//  Copyright © 2015年 doll. All rights reserved.
//

#import "CXRecommendHotCollectionViewCell.h"
#import "Masonry.h"
#import "UIImageView+WebCache.h"
#import "CXRecommendHotModel.h"

@interface CXRecommendHotCollectionViewCell ()

@property (nonatomic, retain) UIImageView *img;
@property (nonatomic, retain) UILabel *label_title;

@end

@implementation CXRecommendHotCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.img = [[UIImageView alloc] init];
        //self.img.backgroundColor = [UIColor blueColor];
        [self.contentView addSubview:self.img];
        
        self.label_title = [[UILabel alloc] init];
        self.label_title.font = [UIFont systemFontOfSize:13];
        //self.label_title.backgroundColor = [UIColor yellowColor];
        self.label_title.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.label_title];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(self.contentView);
        make.bottom.mas_equalTo(self.label_title.mas_top).offset(-10);
    }];
    
    [self.label_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.img.mas_bottom).offset(10);
        make.left.right.bottom.mas_equalTo(self.contentView);
    }];
}

- (void)setModel_hot:(CXRecommendHotModel *)model_hot
{
    _model_hot = model_hot;
    [self.img sd_setImageWithURL:[NSURL URLWithString:self.model_hot.Cover] placeholderImage:[UIImage imageNamed:@""]];
    self.label_title.text = self.model_hot.Title;
}

@end
